for (var i = 0; i < ctHelpers.length; i++)
o.value(ctHelpers[i].name, E('<span><span class="hide-close">%s (%s)</span><span class="hide-open">%s</span></span>'.format(ctHelpers[i].description, ctHelpers[i].name.toUpperCase(), ctHelpers[i].name.toUpperCase())));
- o = s.taboption('advanced', form.Flag, 'log', _('Enable logging on this zone'));
+ o = s.taboption('advanced', form.MultiValue, 'log', _('Enable logging'), _('Log matched packets on the selected tables to syslog.'));
o.modalonly = true;
+ o.value('filter');
+ o.value('mangle');
+ o.placeholder = 'No table selected';
+ const TABLES = { filter: 1, mangle: 2 };
+ o.cfgvalue = function (section_id) {
+ let bitfield = this.super('load', [section_id]) || this.default;
+ return Object.keys(TABLES).filter(table => bitfield & TABLES[table]);
+ };
+ o.write = function (section_id, value) {
+ let bitfield = L.toArray(value).reduce((acc, table) => acc | (TABLES[table] || 0), 0);
+ return this.super('write', [section_id, bitfield]);
+ };
o = s.taboption('advanced', form.Value, 'log_limit', _('Limit log messages'));
- o.depends('log', '1');
+ o.depends({log: [], "!reverse": true});
o.placeholder = '10/minute';
o.modalonly = true;